package edu.mis.modules.orderformitem;

import java.util.List;

import com.jfinal.plugin.activerecord.Record;

import edu.mis.model.Orderformitem;

public class OrderformitemService {
	
	
	/**
	 * 查询订单明细记录
	 * @return
	 */
	public List<Record> findAllRecordWithName(){
		return Orderformitem.dao.findAllRecord();
	}
	
	/**
	 * 根据订单编号编号查找所有订单
	 * @param orderformNumber
	 * @return
	 */
	public List<Orderformitem> findAllOrderformitemByOrderformNumber(int orderformNumber){
		return Orderformitem.dao.findAllOrderformitemByOrderformNumber(orderformNumber);
	}
	
	
	/**
	 * 根据订单号删除订单
	 * @param orderformNumber
	 * @return
	 */
	public boolean deleteOrderformitemByOrderformNumber(int orderformNumber) {
		boolean result = true;
		while(result = true) {
			Orderformitem orderformitem = Orderformitem.dao.findOrderformitemByOrderformNumber(orderformNumber);
			if(orderformitem==null) {
				result=false;
				break;
			}
			orderformitem.delete();
		}
		return result;
	}
	
	
	
}
